#ifndef  _PROTOCOL_H_
#define  _PROTOCOL_H_

#include <sys/types.h>

#define ARP_REQUEST	1
#define ARP_REPLY		2

typedef struct ip_addr{
	u_char ip[4];		//network byte order
}ip_t;

typedef struct mac_addr{ 
	u_char mac[6];		//network byte order
}mac_t;

struct ethernet_header{
	mac_t mac_dst; 		// Destination host address 
	mac_t mac_src; 		// Source host address 
	u_short ether_type;	// IP? ARP? RARP? etc
};
typedef struct ethernet_header ethernet_header_t;

#define SIZE_ETHERNET 	sizeof(struct ethernet_header)


struct arp_header{
	u_int16_t  htype;	//Hardware type
	u_int16_t  ptype;  //Protocol type
	u_char hlen;	//Hardware address length
	u_char plen;	//Protocol address length
	u_int16_t  opcode; //Operation code
	mac_t sha;		//Source hardware address
	ip_t spa;		//Source ip address
	mac_t dha;		//Destination hardware address
	ip_t dpa;		//Destination ip address	
};

typedef struct arp_header arp_header_t;

struct arp_pdu{
	ethernet_header_t eth_head;
	arp_header_t arp;
};

typedef struct arp_pdu arp_pdu_t;


#endif

